package test;

import java.util.Arrays;
import java.util.TreeSet;
import java.util.Vector;

public class test {

    public static void main(String[] args) {
        TreeSet<Integer> treeSet = new TreeSet<>(Integer::compareTo);
        treeSet.add(3);
        treeSet.add(1);
        treeSet.add(4);
        treeSet.add(0);
        treeSet.add(8);
        treeSet.stream().iterator().forEachRemaining(
                System.out::println
        );
        Vector<Integer> v = new Vector<>();
        v.add(1);
        v.add(2);
        v.forEach(System.out::println);
        System.out.println(v.elementAt(1));

        String[] strings = {"1", "22", ""};
        Arrays.sort(strings, (a, b) -> {
            long diff = b.length() - a.length();
            return diff == 0 ? 0 : (diff > 0 ? 1 : -1);
        });
        System.out.println("->>>");
        Arrays.stream(strings).forEach(System.out::println);
    }
}
